/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.ingsoc2;

import java.sql.SQLException;

/**
 *
 * @author sebastian
 */
public class VcPrincipalController {

    private VcPrincipalView pView;
    private VcPrincipalModel pModel;

    /**
     *
     * @param vista
     * @param modelo
     */
    VcPrincipalController(VcPrincipalView vista, VcPrincipalModel modelo) {
        this.pView = vista;
        this.pModel = modelo;

        this.pView.agregarListenerCmdFiltrar(new VcLstPrincipalFiltrar(pView, pModel));
        this.pView.agregarListenerCmdEliminar(new VcLstPrincipalEliminar(pView, pModel));
        this.pView.agregarListenerCmdExportar(new VcLstPrincipalExportar(pView, pModel));
        this.pView.agregarListenerCmdNuevo(new VcLstPrincipalNuevo(pView, pModel));
        this.pView.agregarListenerEditar(new VcLstPrincipalMouse(pView, pModel));

    }

    public void mostrarPantalla() throws SQLException {
        pView.mostrarResultado(pModel.listar());

        this.pView.mostrarPantalla();
        pView.cargarGenero(pModel.listarGenero());
    }

}
